<?php
//包含连接数据库的公共文件
require_once("./conn.php");
    //获取地址栏传递的son
    $son = $_GET['son'];


    //获取当前son对应的信息
    // $sql="insert into insert_student values('$son','$sname','$sbirth','$ssex','$sclass','$zon')";
    $sql = "select * from insert_student where son = $son";
    $set=mysqli_query($con,$sql);

    $arrs = mysqli_fetch_all($set,MYSQLI_ASSOC);


?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>修改学生信息</title>
    <style>
        *{
            padding: 0;
            margin: 0;
        }
        body{
            background:linear-gradient(to right, #29eac4, #4284db);
        }
        .show_up_title{
            text-align: center;
        }
        .show_up_title h2{
            padding-top: 100px;
            color: white;
            letter-spacing: 8pt;
        }
        .show_up_title a{
            display: block;
            margin-top: 30px;
            color: white;
            font-size: 18px;
            text-decoration: none;
        }
        table{
            width: 1000px;
            margin: 50px auto;
            text-align: center;
            border:1px solid white;
        }
        tr{
            height: 50px;
        }
    </style>
</head>
<body>
    <div class="show_up_title">
        <h2>修改学生信息</h2>
        <a href="./show.php">返回查看页</a>
    </div>

        
    
<form action="./update.php" method="post">
    <table rules="all" cellpadding="5">
        <tr>
            <th>学生学号</th>
            <th>学生姓名</th>
            <th>出生日期</th>
            <th>性别</th>
            <th>班级</th>
            <th>专业号</th>
            <th>操作选项</th>
        </tr>
        <?php
            
            foreach($arrs as $arr){
        ?>
        <tr align="center">
            <td><input type="text" name="son" id="son"  value= "<?php echo $arr['son']?>"></td>
            <td><input type="text" name="sname" value="<?php echo $arr['sname']?>"></td>
            <td><input type="date" name="sbirth" id="" value="<?php echo $arr['sbirth']?>"></td>       
            <td>
                <input type="radio" name="ssex" value="男" <?php echo $arr['ssex'] == '男' ? 'checked="checked"' : '';?>>男
                <br>
                <input type="radio" name="ssex" value="女" <?php echo $arr['ssex'] != '男' ? 'checked="checked"' : '';?>>女
            </td>
            <td><input type="text" name="sclass" id="" value="<?php echo $arr['sclass']?>"></td>            
            <td>
            <input type="text" name="zon" id="" value="<?php echo $arr['zon']?>">
                
            </td>  
            <td>
            <input type="submit" value="提交" name="submit">
            
            </td>          
        </tr>
        <?php }?>
    </table>
</form>
</body>
</html>